<template>
  <div class="school">
    <h2 @click="showName">学校姓名：{{ name | mySlice }}</h2>
    <h2>学校地址：{{ address }}</h2>
  </div>
</template>

<script>
// 局部混合
import {showName} from "@/mixins";

import pubsub from "pubsub-js";


export default {
  name: "School",
  data() {
    return {
      name: "ABC12312321",
      address: "深圳",
    }
  },
  methods: {
    test() {
      this.hello();
    },
    sendSchoolName(name) {
      this.appGetSchoolName(name);
    }
  },
  mounted() {
    this.pubid_hello = pubsub.subscribe('hello', (name, data) => {
      console.log('发布hello', name, data);
    });
  },
  beforeDestroy() {
    pubsub.unsubscribe(this.pubid_hello);
  },
  computed: {},
  components: {},
  mixins: [showName],
  watch: {},
  filters: {},
  directives: {},
  props: ['appGetSchoolName'],
}
</script>

<style scoped>
.school {
  background-color: skyblue;
  padding: 5px;
}
</style>